#pragma once
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#include "V2D.h"

#define KEYBUF 256

// Handles input for entire game as a singleton
class Input
{
private:
	HWND					m_hWnd;				// Windows handle
	IDirectInput8*			m_pDIObject;		// Direct Input Object
	LPDIRECTINPUTDEVICE8W	m_pDIKeyboard;		// Keyboard Input
	LPDIRECTINPUTDEVICE8W	m_pDIMouse;			// Mouse Input
	DIMOUSESTATE2			mouseState;			// Mouse State
	BYTE					keyboardState[KEYBUF];		// storage for keyboard information
	bool					mouseClicked;		// mouse clicked
	bool					keysLastUpdate[KEYBUF];		// key update
	Input(void);
public:
	~Input(void);

	static Input* getInstance();
	void initialize(HWND hWnd, HINSTANCE hInst);
	void pollDevices();
	bool keyDown(int key);
	bool keyPressed(int key);
	bool mouseButtonDown(int button);
	V2DF getMousePos();
	void release();
};